Skip to content
QtWS25 Last Chance
  • 0 Votes
    2 Posts
    1k Views
    J.HilkJ
    @vinaygopal you could customise your Spinbox and set your own TextInput, that one still has the selectByMouse, even if 5.15.8 https://doc.qt.io/qt-5/qtquickcontrols2-customize.html#customizing-spinbox https://doc.qt.io/qt-5/qml-qtquick-textinput.html#selectByMouse-prop
  • 0 Votes
    2 Posts
    551 Views
    sierdzioS
    You will get better performance (and more help from Qt docs) if you use QQuickPaintedItem and draw this in C++.
  • how to access properties in a delegate

    Unsolved QML and Qt Quick qt 5.7 qml delegate qt quick
    4
    0 Votes
    4 Posts
    687 Views
    B
    @vinaygopal "what if i want to access the visibility or a property i have defined in the delegate?" There are multiple instances of your delegate, corresponding to the part of the model being displayed. Which instance do you want the property from? If it's a common property that is not specific to a single instance, then the same answer applies - factor it out to the table level and use it in the delegate. If it is a property specific to a delegate instance you are interested in, how do you specify which delegate? Does the data actually belong to the model? What is it that you are trying to achieve?
  • 0 Votes
    2 Posts
    453 Views
    SGaistS
    Hi, For highly specific platform API, you will have to write some platform specific code. Qt can't cover absolutely everything and it's not its goal. Android is a bit of a special case because of its use of Java. You should take a look at the QtAndroidExtras module and its examples. Note that this is really specific to Android and how it works. There are other extras modules for some often used platform specific stuff that you can take a look at in terms of how things can be done. Note that these modules have been deprecated for Qt 6 in favor of a different approach and integration in a more centralized way.
  • 0 Votes
    4 Posts
    718 Views
    sierdzioS
    Hm, it should work then, no idea.
  • 0 Votes
    15 Posts
    2k Views
    M
    I can solve the problem. First, I created folder sqldrivers including libqsqlite.so in the app directory (e.x. /data/user/0/com.example.polarislib) and I set permission by chmod 777 to sqldrivers folder and libqsqlite.so file and finally I used the following code in my source where the connection to Sqlite is needed: QCoreApplication::addLibraryPath("/data/user/0/com.example.polarislib");
  • 0 Votes
    3 Posts
    2k Views
    JonBJ
    @Sivamani-V said in How to connect to mysql server in ubuntu 16.04?.: QMYSQL Driver not loaded. Available drivers: QMYSQL QSQLITE QMYSQL3 This gets asked so many times, here & elsewhere. Googling for your message will bring up many hits. Under Linux/Ubuntu it's usually libmysqlclient or libqt5sql5-mysql or similar which is missing/has dependencies missing/wrong version.
  • 0 Votes
    6 Posts
    2k Views
    SGaistS
    The idea is that you have your container widget getting resized and in its resize event, you change the size of the inner widgets with the ratio you want.
  • Point Cloud Library: Sliced points to custom colors

    Solved Mobile and Embedded qt 5.7 vtk pcl
    2
    0 Votes
    2 Posts
    890 Views
    S
    we can change the rgb values of each point in a cloud
  • I have a problem text rendering with Qt 5.7(QML)

    Solved General and Desktop qml text qlabel qt 5.7
    4
    0 Votes
    4 Posts
    2k Views
    M
    I resolve it. I setted font of text as property of QML Text component. (Like font.family : parent.fontfamily) and on Qt 5.7's QML, there are no enough options to control font properties. so, I moved to C++ side and set a whole application font. QFont font = someClass.getLangFont(); //set property of font instance here // such as hinting policy, style etc. QApplication::setFont(font); now it looks very cleary... thank you..
  • QKeyPress - Simulating key press

    Solved General and Desktop qkeyevent qt 5.7
    4
    0 Votes
    4 Posts
    4k Views
    Z
    @sayan275 Dear Sayan I think you may know the answer to my problem. I'm struggling to send a self-defined event from main.cpp to the ui->boardView in mainwindow.cpp, as the ui->boardView is only defined in mainwindow.cpp. Yet the eventfilter can only be installed on the ui->boardView. It seems you've done similar sth similar. Could you please tell me how to realize such feature? (there are also detailed code about this which I put on stackoverflow https://stackoverflow.com/questions/60424216/how-to-use-eventfilter-under-child-widget-to-catch-self-define-event)
  • Key press event to choose list

    Solved General and Desktop qtcreator qt5.5 qt 5.7 qkeypressevent
    14
    0 Votes
    14 Posts
    4k Views
    SGaistS
    My bad, I misread from where the signal came from.
  • How to add scroll bar action

    Solved General and Desktop qt5.8.0 qt 5.7 scroll bar scrolling
    12
    0 Votes
    12 Posts
    5k Views
    SGaistS
    Did you try to determine why they don't appear ?
  • Add textEdits on listWidget

    Solved General and Desktop qt5.5 qt4 qt 5.7 listwidget
    15
    0 Votes
    15 Posts
    7k Views
    K
    @Devopia53 it works! , Thanks alot
  • 0 Votes
    7 Posts
    10k Views
    G
    @GregWilsonLindberg I think that the g++ version is what is doing it. The old version of rasbian is using g++ v4.9.2. The new version of rasbian is using g++ v6.3.0-18+. For the old compiler we had had to add an "INCLUDEPATH = /usr/include" line into the .pro file to get everything picked up properly. For the new compiler (and the change from #include to #include_next in cstdlib) that messes up. I'm removing the INCLUDEPATH, (which seems to have been included as -isystem instead of -I) and that is fixing the problem.
  • 1 Votes
    1 Posts
    1k Views
    No one has replied
  • 0 Votes
    3 Posts
    2k Views
    ekkescornerE
    I'll try out soon Samsung S8 plus Samsung DeX Samsung DeX is connected to a HD Monitor via HDMI and apps running on S8 are automatically running on this external monitor as soon as S8 is placed into the DeX dock. will my QtQuickControls2 APP run under this environment ? will the change of DPI and size work ? I'll let you know ...
  • Can we use CSS on QPushButton

    Unsolved General and Desktop stylesheet qt 5.7 css
    6
    0 Votes
    6 Posts
    9k Views
    IMAN4KI
    @Swapnil_Shelke To create those kind of buttons you need more than CSS. You must go into button's paintEvent and then draw what you need (there are 3 simultaneous animation BTW) : #include <QtCore/qvariantanimation.h> #include <QtCore/qvariant.h> #include <QtWidgets/qabstractbutton.h> #include <QtWidgets/qapplication.h> #include <QtWidgets/qlayout.h> class Animation : public QVariantAnimation { Q_OBJECT public: Animation(QObject *parent = 0) :QVariantAnimation(parent) { setTargetWidget(qobject_cast<QWidget*>(parent)); setAutoUpdateEnable(true); } void setAutoUpdateEnable(bool a) { if (targetWidget()) { a ? QObject::connect(this, SIGNAL(valueChanged(QVariant)), targetWidget(), SLOT(update())) : QObject::disconnect(this, SIGNAL(valueChanged(QVariant)), targetWidget(), SLOT(update())); } } QWidget *targetWidget() const { return _target; } void setTargetWidget(QWidget *w) { _target = w; } QVariant value() const { return _value; } void setValue(const QVariant &variant) { if (_value == variant) return; _value = variant; } protected: void updateCurrentValue(const QVariant &value) override { setValue(value); } private: QVariant _value; QWidget *_target = nullptr; }; class SampleButton :public QAbstractButton { public: struct ButtonStyle { qreal border_radius = 4.0; QColor background_color = QColor("#f4511e"); QColor text_color = QColor("#ffffff"); int font_size = 28; QString font_family = "Arial"; int width = 200; int padding = 20; qreal hover_padding = 25; int duration = 600; QIcon icon = QIcon("next.png"); // http://www.flaticon.com/free-icon/double-angle-pointing-to-right_25358 @16x16 qreal pixmap_padding = 20; }; SampleButton(const QString &text, QWidget *parent = 0) :QAbstractButton(parent), _textEff(new Animation(this)), _pixmapEff0(new Animation(this)), _pixmapEff1(new Animation(this)) { setFont(QFont(_st.font_family, _st.font_size)); setText(text); } QSize sizeHint() const override { return QSize(_st.width, _st.padding + fontMetrics().height() + _st.padding); } protected: void paintEvent(QPaintEvent *) override { QPainter p(this); // draw background p.setPen(Qt::NoPen); p.setBrush(_st.background_color); p.setRenderHint(QPainter::Antialiasing, true); p.drawRoundedRect(rect(), _st.border_radius, _st.border_radius); p.setRenderHint(QPainter::Antialiasing, false); // draw text if (!text().isEmpty()) { p.setFont(font()); p.setPen(_st.text_color); p.setRenderHint(QPainter::TextAntialiasing, true); p.drawText(QRectF(rect().x() - _textEff->value().toReal(), rect().y(), rect().width(), rect().height()), Qt::AlignCenter, text()); p.setRenderHint(QPainter::TextAntialiasing, false); } // draw icon if (!_st.icon.isNull()) { p.setRenderHint(QPainter::SmoothPixmapTransform, true); auto s = _st.icon.availableSizes().at(0); p.setOpacity(_pixmapEff0->value().toReal()); p.drawPixmap(QPointF(rect().right() - (_st.pixmap_padding * 2) - _pixmapEff1->value().toReal(), rect().center().y() - s.width() / 4), _st.icon.pixmap(s)); } } void enterEvent(QEvent *e) { _textEff->setStartValue(0.0); _textEff->setEndValue(_st.hover_padding); _textEff->setDuration(_st.duration); _textEff->setEasingCurve(QEasingCurve::OutCubic); _textEff->start(); _pixmapEff0->setStartValue(0.0); _pixmapEff0->setEndValue(1.0); _pixmapEff0->setDuration(_st.duration); _pixmapEff0->setEasingCurve(_textEff->easingCurve()); _pixmapEff0->start(); _pixmapEff1->setStartValue(0.0); _pixmapEff1->setEndValue(_st.pixmap_padding); _pixmapEff1->setDuration(_st.duration); _pixmapEff1->setEasingCurve(_textEff->easingCurve()); _pixmapEff1->start(); QWidget::enterEvent(e); } void leaveEvent(QEvent *e) { _textEff->setStartValue(_st.hover_padding); _textEff->setEndValue(0.0); _textEff->setDuration(_st.duration); _textEff->start(); _pixmapEff0->setStartValue(1.0); _pixmapEff0->setEndValue(0.0); _pixmapEff0->setDuration(_st.duration); _pixmapEff0->start(); _pixmapEff1->setStartValue(_st.pixmap_padding); _pixmapEff1->setEndValue(0.0); _pixmapEff1->setDuration(_st.duration); _pixmapEff1->setEasingCurve(_textEff->easingCurve()); _pixmapEff1->start(); QWidget::leaveEvent(e); } private: ButtonStyle _st; Animation *_textEff = nullptr; Animation *_pixmapEff0 = nullptr; Animation *_pixmapEff1 = nullptr; }; int main(int argc, char *argv[]) { QApplication app(argc, argv); QWidget *dialog = new QWidget; dialog->setWindowFlags(Qt::FramelessWindowHint); QHBoxLayout _Layout; dialog->setLayout(&_Layout); SampleButton *sb = new SampleButton("Hover"); _Layout.addWidget(sb); dialog->show(); return app.exec(); } #include "main.moc" [image: Kgjed.gif]
  • 0 Votes
    5 Posts
    4k Views
    M
    @Swapnil_Shelke Happy to see that it helped you, You are welcome =)